package com.taotao.protal.controller;

import com.taotao.protal.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by 李小磊 on 2017/3/25.
 */
@Controller
public class IndexController {
    
    @Autowired
    private ContentService service;
    
    @RequestMapping("/index")
    public String showIndex(Model mod){
        String result = service.getAd1List();
        mod.addAttribute("ad1",result);
        return "index";
    }

    @RequestMapping(value = "/posttest", method= RequestMethod.POST)
    @ResponseBody
    public String posttest(String name,String age){
        System.out.println(name);
        System.out.println(age);
        return "OK";
    }
}
